<extend name="Public/forum"/>

<block name="body">
    <if condition="$list_top">
        <div class="row fourm-top">
            <h2>置顶推荐</h2>

            <div class="col-xs-12">
                <section id="top">
                    <volist name="list_top" id="document">
                        <php>
                            $user = query_user(array('avatar128','username','uid','space_url','icons_html'),
                            $document['uid']);
                        </php>
                        <div class="row">
                            <div class="col-xs-1">
                                <p>
                                    <a href="{$user.space_url}">
                                        <img src="{$user.avatar128}" ucard="{$user.uid}" class="avatar-img"
                                             style="width:100%;"/>
                                    </a>
                                </p>
                            </div>
                            <div class="col-xs-11">

                                <p>
                                    <a class="forum-list-title-link" title="{$document.title|htmlspecialchars}"
                                       href="{:U('Index/detail',array('id'=>$document['id']))}">
                                        {$document.title|htmlspecialchars|mb_substr=0,30,'utf-8'}
                                        <eq name="document.is_top" value="2"><i class="post_top">全站</i>
                                            <else/>
                                            <eq name="document.is_top" value="1"><i class="post_top_forum">版块</i></eq>
                                        </eq>

                                    </a>
                                </p>

                                <p class="pull-right text-muted">
                                    <span>阅读（{$document.view_count}）</span>
                                    <span style="width: 1em; display: inline-block;">&nbsp;</span>
                                    <span>回复（{$document.reply_count}）</span>
                                </p>

                                <p class="text-muted author">
                                    <a href="{$user.space_url}" ucard="{$user.uid}">{$user.username}</a>{$user.icons_html}
                                    发布：{$document.create_time|friendlyDate} |
                                    回复：{$document.last_reply_time|friendlyDate}
                                </p>
                            </div>
                        </div>
                        <if condition="$i neq count($list_top)">
                            <hr class="forum-list-hr"/>
                            <else/>
                            <div class="forum-list-no-hr"></div>
                        </if>
                    </volist>
                </section>
            </div>
        </div>
    </if>

    <div class="row fourm-posts">

        <div class="row">
            <div class="col-xs-9">
                <h2>帖子列表</h2>
            </div>
            <div class="col-xs-3">
                <div class="pull-right" style="margin-right: 20px"><a href="{:U('forum',array('id'=>$_GET['id'],'order'=>'ctime'))}">发布时间</a>&nbsp;&nbsp;&nbsp;<a
                        href="{:U('forum',array('id'=>$_GET['id'],'order'=>'reply'))}">回复数</a></div>
            </div>
        </div>
        <div class="col-xs-12">
            <section id="contents">
                <if condition="!$list">
                    <div class="row">
                        <div class="col-xs-12">
                            <p class="text-muted" style="text-align: center; font-size: 3em;">
                                <br/><br/>
                                暂时没有帖子～
                                <br/><br/><br/>
                            </p>
                        </div>
                    </div>
                </if>
                <volist name="list" id="document">
                    <php>
                        $user = query_user(array('avatar128','username','uid','space_url','icons_html'),
                        $document['uid']);
                    </php>
                    <div class="row">
                        <div class="col-xs-1">
                            <p>
                                <a href="{$user.space_url}">
                                    <img src="{$user.avatar128}" ucard="{$user.uid}" class="avatar-img"
                                         style="width:100%;"/>
                                </a>
                            </p>
                        </div>
                        <div class="col-xs-11">
                            <p>
                                <a class="forum-list-title-link" title="{$document.title|htmlspecialchars}"
                                   href="{:U('Index/detail',array('id'=>$document['id']))}">
                                    {$document.title|htmlspecialchars|mb_substr=0,30,'utf-8'}
                                    <eq name="document.is_top" value="2"><i class="post_top">全站</i>
                                        <else/>
                                        <eq name="document.is_top" value="1"><i class="post_top_forum">版块</i></eq>
                                    </eq>
                                </a>
                            </p>

                            <p class="pull-right text-muted ">
                                <span>阅读（{$document.view_count}）</span>
                                <span style="width: 1em; display: inline-block;">&nbsp;</span>
                                <span>回复（{$document.reply_count}）</span>
                            </p>

                            <p class="text-muted author">
                                <a href="{$user.space_url}" ucard="{$user.uid}">{$user.username}</a>{$user.icons_html}
                                发布：{$document.create_time|friendlyDate} |
                                回复：{$document.last_reply_time|friendlyDate}

                            </p>
                        </div>
                    </div>
                    <if condition="$i neq count($list)">
                        <hr class="forum-list-hr"/>
                        <else/>
                        <div class="forum-list-no-hr"></div>
                    </if>
                </volist>
                <div class="pull-right">
                    {:getPagination($totalCount)}
                </div>
            </section>
        </div>
    </div>

</block>
